import numpy as np

# 创建数组
# 从列表创建
arr1 = np.array([1, 2, 3, 4, 5])
print("一维数组:", arr1)

# 创建二维数组
arr2 = np.array([[1, 2, 3], [4, 5, 6]])
print("二维数组:\n", arr2)

# 创建特殊数组
zeros = np.zeros(5) # 创建一个全0数组
print( "全零数组:",zeros)
ones = np.ones((2,3)) # 全1数组
print( "全一数组:\n",ones)
full = np.full((2,3), 7) # 填充值数组
print("填充值数组:\n", full)
eye = np.eye(3) # 单位矩阵
print( "单位矩阵:\n",eye)
random_arr = np.random.random((2,3)) # 创建一个随机数组
print( "随机数组:\n",random_arr)

# 数组属性
print("数组形状:", arr2.shape)
print("数组维度:", arr2.ndim)
print("数组大小:", arr2.size)
print("数组数据类型:", arr2.dtype)